package ReadWriteFieldsRelations;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.*;

	public class ReadWriteMethods {
	  

		final Map<String, List<String>> writeMethods = new HashMap <String, List<String>>();
		final Map<String, List<String>> readMethods = new HashMap <String, List<String>>();
		final Map<String, List<String>> callMethods = new HashMap<String, List<String>> ();
	  void read(String className, String methodName) {
			if (readMethods.get(className) == null)
				readMethods.put(className, new LinkedList<String>());
			List<String> readMethodList = (List<String>) readMethods.get(className);
			if(!readMethodList.contains(methodName))
				readMethodList.add(methodName);
	  }
	  

	  
	  void write(String className, String methodName) {
			if (writeMethods.get(className) == null)
				writeMethods.put(className, new LinkedList<String>());
			List<String> writeMethodList = (List<String>) writeMethods.get(className);
			if(!writeMethodList.contains(methodName))
				writeMethodList.add(methodName);
	  }
	  void calls(String className, String methodName) {
			if (callMethods.get(className) == null)
				callMethods.put(className, new LinkedList<String>());
			List<String> callMethodList = (List<String>) callMethods.get(className);
			if(!callMethodList.contains(methodName))
				callMethodList.add(methodName);
	  }

	  
	  Map<String, List<String>> getReadMethods(){
		  return this.readMethods;
	  }
	  Map<String, List<String>> getWriteMethods(){
		  return this.writeMethods;
	  }
	  Map<String, List<String>> getcallMethods(){
		  return this.callMethods;
	  }
	  		  	  

	}
